package org.appfuse.model;

import org.apache.commons.lang.builder.CompareToBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * @struts.form include-all="true" extends="org.appfuse.webapp.form.BaseForm"
 * @hibernate.class table="Criteria"
 */
public class Criteria extends BaseObject implements Comparable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2960635503341387820L;

	private Long criteriaId;

	private String parentName;

	private String parentNumber;

	private String criteriaName;

	private String title;

	private String description;

	private String location;

	private String criteriaNumber;

	/**
	 * @hibernate.property column="description" length="100"
	 * @return
	 */
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @hibernate.id column="id" generator-class="increment"
	 *               unsaved-value="null"
	 */
	public Long getCriteriaId() {
		return criteriaId;
	}

	public void setCriteriaId(Long id) {
		this.criteriaId = id;
	}

	/**
	 * @hibernate.property column="name" length="50"
	 */
	public String getCriteriaName() {
		return criteriaName;
	}

	public void setCriteriaName(String name) {
		this.criteriaName = name;
	}

	/**
	 * @hibernate.property column="criterianumber" length="50" not_null="true"
	 *                     unique="true"
	 */
	public String getCriteriaNumber() {
		return criteriaNumber;
	}

	public void setCriteriaNumber(String number) {
		this.criteriaNumber = number;
	}

	public String getParentName() {
		return parentName;
	}

	public void setParentName(String parentName) {
		this.parentName = parentName;
	}

	/**
	 * @hibernate.property column="title" length="50"
	 */
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * @see java.lang.Comparable#compareTo(Object)
	 */
	public int compareTo(Object object) {
		Criteria myClass = (Criteria) object;
		return new CompareToBuilder().append(this.title, myClass.title).append(
				this.parentName, myClass.parentName).append(this.criteriaId,
				myClass.criteriaId).append(this.description,
				myClass.description).append(this.criteriaName,
				myClass.criteriaName).append(this.criteriaNumber,
				myClass.criteriaNumber).toComparison();
	}

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof Criteria)) {
			return false;
		}
		Criteria rhs = (Criteria) object;
		return new EqualsBuilder().append(this.parentNumber, rhs.parentNumber)
				.append(this.criteriaNumber, rhs.criteriaNumber).isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(1950531667, 2088968965).append(
				this.parentNumber).append(this.criteriaNumber).toHashCode();
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this).append("criteriaNumber",
				this.criteriaNumber).append("criteriaName", this.criteriaName)
				.append("description", this.description).append("title",
						this.title).append("parentNumber", this.parentNumber)
				.toString();
	}

	/**
	 * @hibernate.property column="location" length="255"
	 * @return
	 */
	public String getLocation() {
		return location;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	/**
	 * @hibernate.property column="parentNumber" length="255"
	 * @return
	 */
	public String getParentNumber() {
		return parentNumber;
	}

	public void setParentNumber(String parentNumber) {
		this.parentNumber = parentNumber;
	}

}
